import request from '@/utils/request'

const job = {

  /**
   * 分页
   * @param page
   * @param query
   */
  listJob(page,query) {
    return request({
      url: 'admin/sys-job/page/' + page.current + '/' + page.size,
      method: 'get',
      params: query

    })
  },
  getJob(id) {
    return request({
      url: 'admin/sys-job/get/'+id,
      method: 'get'

    })
  },
  delJob(ids) {
    return request({
      url: 'admin/sys-job/remove/'+ids,
      method: 'delete'

    })
  },
  addJob(data) {
    return request({
      url: 'admin/sys-job/create',
      method: 'post',
      data: data

    })
  },
  updateJob(data) {
    return request({
      url: 'admin/sys-job/update',
      method: 'put',
      data: data

    })
  },
  exportJob() {
    return request({
      url: 'admin/sys-job/list/export',
      method: 'get'

    })
  },
  runJob(id, jobGroup) {
    const data = {
      id,
      jobGroup
    }
    return request({
      url: 'admin/sys-job/run',
      method: 'put',
      data:data

    })
  },
  changeJobStatus(id, status) {
    const data = {
      id,
      status
    }
    return request({
      url: 'admin/sys-job/change/status',
      method: 'put',
      data:data

    })
  },

}

export default job
